<template>
  <div class="StatisticsList">
    <el-main>
      <div>
        <el-form ref="form" :model="form">
          <el-form-item>
            <el-row>
              <el-col :span="8">
                <div class="grid-content bg-purple">
                  <el-input
                    placeholder="请输入关键字进行搜索"
                    v-model="input5"
                    class="input-with-select"
                    style="width:270px;"
                  >
                    <el-button slot="append" icon="el-icon-search"></el-button>
                  </el-input>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="grid-content bg-purple-light">
                  <el-button type="primary" icon="el-icon-document">导出</el-button>
                </div>
              </el-col>
            </el-row>
          </el-form-item>
        </el-form>
      </div>
      <el-table
        ref="multipleTable"
        :data="tableData3"
        border
        height="361"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="State" label="状态" width="150" :formatter="formatState"></el-table-column>
        <el-table-column prop="pictureUrl" label="照片" width="120"></el-table-column>
        <el-table-column prop="assetCode" label="资产条码" width="120"></el-table-column>
        <el-table-column prop="assetName" label="资产名称" width="120"></el-table-column>
        <el-table-column prop="standardType" label="规格" width="120"></el-table-column>
        <el-table-column prop="sn" label="SN号" width="120"></el-table-column>
        <el-table-column prop="unit" label="计量单位" width="120"></el-table-column>
        <el-table-column prop="amount" label="金额(单位:万元)" width="200"></el-table-column>
        <el-table-column prop="useCompany" label="使用公司" width="120"></el-table-column>
        <el-table-column prop="useDept" label="使用部门" width="120"></el-table-column>
        <el-table-column prop="buyDate" label="购入时间" width="120"></el-table-column>
        <el-table-column prop="useUser" label="使用人" width="120"></el-table-column>
        <el-table-column prop="ownCompany" label="所属公司" width="200"></el-table-column>
        <el-table-column prop="area" label="区域" width="120"></el-table-column>
        <el-table-column prop="storageLocation" label="存放地点" width="120"></el-table-column>
        <el-table-column prop="deadLine" label="使用期限(月)" width="120"></el-table-column>
        <el-table-column prop="assetAdmin" label="管理员" width="120"></el-table-column>
        <el-table-column prop="remark" label="备注 " width="120"></el-table-column>
      </el-table>
      <br>
      <div class="block">
        <el-row :gutter="20">
          <el-col :span="4">
            <div class="grid-content bg-purple">
              <span class="demonstration">已选择0条</span>
            </div>
          </el-col>
          <el-col :span="10">
            <div class="grid-content bg-purple">
              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage4"
                :page-sizes="[10, 20, 30, 40]"
                :page-size="10"
                layout="prev, pager, next, sizes, jumper"
                :total="400"
              ></el-pagination>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-main>
  </div>
</template>
<script>
import { axiosPost, axiosGet } from "@/api/index.js";
export default {
  data() {
    return {
      input5:"",
      form: {
        useCompany: ""
      },
      tableData3: [
      /*   {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-08",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-06",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-07",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        } */
      ],
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      multipleSelection: []
    };
  },
  //获取资产列表接口数据
  created() {
    axiosGet(
      "/Asset/GetAssetList?userId=D52A08C4-3A0B-4A4A-B929-89E7E45481E2",
      null
    ).then(res => {
      if (res.status == 200 && res.data.success) {
        this.tableData3 = res.data.data;
      }
    });
  },
  methods: {
    toggleSelection(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    //将数据库对应的数字转换成在用 闲置 报废
    formatState: function(row, column) {
      return row.state === 1 ? "闲置" : row.state === 2 ? "在用" : "报废";
    },
  }
};
</script>
<style lang="scss" scoped>
</style>
